-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check agent cg after goal state processed and handle extensions to starts in extension slice #2546
Conversation
if self.is_azuremonitorlinuxagent(self.get_full_name()) and \ | ||
not CGroupConfigurator.get_instance().is_extension_resource_limits_setup_completed(self.get_full_name()): | ||
# This check to call the setup if extension already installed and not called setup before | ||
if not CGroupConfigurator.get_instance().is_extension_resource_limits_setup_completed(self.get_full_name()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used to do it for only AMA but this setup needed for every extension to starts in VMExtension slice.
Codecov Report
@@ Coverage Diff @@
## develop #2546 +/- ##
===========================================
+ Coverage 71.76% 71.79% +0.03%
===========================================
Files 102 102
Lines 15314 15321 +7
Branches 2426 2429 +3
===========================================
+ Hits 10990 11000 +10
+ Misses 3834 3829 -5
- Partials 490 492 +2
Continue to review full report at Codecov.
|
@@ -540,7 +540,7 @@ def __try_set_cpu_quota(quota): | |||
return False | |||
return True | |||
|
|||
def check_cgroups(self, cgroup_metrics): | |||
def check_cgroups(self, cgroup_metrics=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None is not a good default value. Maybe a list of values, or an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
azurelinuxagent/ga/update.py
Outdated
@@ -614,6 +614,10 @@ def _process_goal_state(self, exthandlers_handler, remote_access_handler): | |||
self._extensions_summary = ExtensionsSummary() | |||
exthandlers_handler.run() | |||
|
|||
# check cgroup and disable if any extension started in agent cgroup after goal state processed. | |||
# Note: Monitor thread periodically checks this in addition to here. | |||
CGroupConfigurator.get_instance().check_cgroups() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since now this is called from 2 threads, please verify the method is thread-safe or add a lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added locking.
@@ -131,6 +132,7 @@ def __init__(self): | |||
self._cgroups_api = None | |||
self._agent_cpu_cgroup_path = None | |||
self._agent_memory_cgroup_path = None | |||
self._lock = threading.RLock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this to help document what the lock is meant to be used for?
_check_cgroups_lock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
13d1dda
to
9c490c4
Compare
Description
Issue #
PR information
Quality of Code and Contribution Guidelines